//
//  ESTrainStationNetResult.m
//  EasyStyle
//
//  Created by FK on 15/12/17.
//  Copyright © 2015年 FK. All rights reserved.
//

#import "ESTrainStationNetResult.h"
#import "ESTrainListInfo.h"
@implementation ESTrainStationNetResult

// 解析业务数据
- (void)parseNetResult:(NSDictionary *)jsonDictionary
{
    _trainList = [NSMutableArray array];
    
    [super parseNetResult:jsonDictionary];
    
    if ([self.result isKindOfClass:[NSDictionary class]]) {
     
        _title = self.result[@"title"];
        
        NSArray *list = self.result[@"list"];
        
        for (NSDictionary *dict in list) {
            ESTrainListInfo *listItem = [ESTrainListInfo new];
            listItem.price_list = [NSMutableArray array];
            
            listItem.train_no = dict[@"train_no"];
            listItem.train_type = dict[@"train_type"];
            listItem.start_station = dict[@"start_station"];
            listItem.start_station_type = dict[@"start_station_type"];
            listItem.end_station = dict[@"end_station"];
            listItem.end_station_type = dict[@"end_station_type"];
            listItem.start_time = dict[@"start_time"];
            listItem.end_time = dict[@"end_time"];
            listItem.run_time = dict[@"run_time"];
            listItem.run_distance = dict[@"run_distance"];
            listItem.m_train_url = dict[@"m_train_url"];
            listItem.m_chaxun_url = dict[@"m_chaxun_url"];
            
            NSArray *priceList = dict[@"price_list"];
            for (NSDictionary *dict in priceList) {
                PriceList *priceItem = [PriceList new];
                priceItem.price_type = dict[@"price_type"];
                priceItem.price = dict[@"price"];
                [listItem.price_list addObject:priceItem];
            }
            
            [_trainList addObject:listItem];
        }

    }
}

@end
